//
//  BLSearchBar.m
//  新浪微博
//
//  Created by hbl on 16/2/18.
//  Copyright © 2016年 hbl. All rights reserved.
//

#import "BLSearchBar.h"

@implementation BLSearchBar

 - (instancetype)initWithFrame:(CGRect)frame
{
    if (self = [super initWithFrame:frame]) {
       // UITextField *blSearchBar = [[UITextField alloc]init];
        self.bounds = CGRectMake(0, 0, 340, 30);
        UIImage *background = [UIImage imageNamed:@"searchbar_textfield_background_os7"];
        background = [background resizableImageWithCapInsets:UIEdgeInsetsMake(background.size.height * 0.5, background.size.width * 0.5, background.size.height * 0.5, background.size.width * 0.5) resizingMode:UIImageResizingModeTile];
        [self setBackground:background];
        UIImageView *leftImage = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"searchbar_textfield_search_icon"]];
        leftImage.bounds = CGRectMake(0, 0, 30, 30);
        leftImage.contentMode = UIViewContentModeCenter;
        [self setLeftView:leftImage];
        self.leftViewMode = UITextFieldViewModeAlways;
        self.placeholder = @"搜索";
    }
    return  self;
}

@end
